(function ({form,table,layer,laydate,radioAndAelectData,url,contentType,ok,AjaxFn,vpositionid,vpositionname}) {

    radioAndAelectData = (function (obj) {
        return AjaxFn(url+"radioAndAelectData",'',{});
    })({}),

    (function ({factorys='',option='<option value=""></option>'}) {
        for (let i in factorys){
            option += `<option value="${factorys[i].scode}">${factorys[i].vname}</option>`;
        }
        $("select[name=vFactoryFlg]").html(option);
    })(radioAndAelectData),

    (function ({appraises='',radio=''}) {
        for (let i in appraises){
            let checked = appraises[i].scode==0?"checked":'';
            radio += `<input type="radio" ${checked} name="vAppraiseFlg" value="${appraises[i].scode}" title="${appraises[i].vname}">`;
        }
        $("#vAppraiseFlgRadio").html(radio);

    })(radioAndAelectData),

    form.render();

    form.on("submit(teamAdd)",function ({field}) {
        let {msg,code} = AjaxFn(url+"teamAdd",JSON.stringify(field),{}) ;
        code==200?ok(msg,1):layer.msg(msg,{icon: 5});
        return false;
    })


})({
    form: layui.form,
    table: layui.table,
    layer: layui.layer,
    laydate:layui.laydate,
    radioAndAelectData:{},
    url: "/evaluation/positionAndTeam/",
    vpositionid:$("#vpositionid").val(),
    vpositionname:$("#vpositionname").val(),
    contentType: 'application/json;charset=utf-8',
    ok:function(msg,icon){
        layui.layer.confirm(msg, {
            id: "ok",
            icon: icon,
            anim: 4,
            title: '提示',
            btn: ['确定'],
            closeBtn:false,
            success: function (layero) {
                var btn = layero[0].getElementsByClassName('layui-layer-btn')[0].getElementsByTagName('A')[0];
                btn.href = 'javascript:void(0)';
                btn.focus();
            },
            yes: function(index, layero){
               layer.close(index); //再执行关闭
            },
            end:function () {
                var index2 = parent.layer.getFrameIndex(window.name);
                parent.layer.closeAll();
            }
        });
    },
    AjaxFn:function (url,data,resource) {
        $.ajax({
            url,
            contentType:'application/json;charset=utf-8',
            type:'post',
            async:false,
            data,
            success:function(res) {
                let {msg='',code=''} =res;
                msg=='' && code==''? top.location.reload() : "";
                resource = res;
            }
        });
        return resource;
    },
})